/* Author : Putri Andita R
 * 		    091511059
 * Proyek 4*/

package jtk.project4.fleet.field;

import java.awt.Button;
import java.awt.Dimension;
import java.awt.FlowLayout;


import jtk.project4.fleet.action.AddEditPartToPurchaseOrderAction;
import jtk.project4.fleet.action.EditScheduleAction;
import jtk.project4.fleet.action.NewEditScheduleAction;
import jtk.project4.fleet.action.PMScheduleSetupAction;

import nl.coderight.jazz.action.Action;
import nl.coderight.jazz.form.FormField;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.SelectField;
import nl.coderight.jazz.form.field.button.PushButton;


public class ScheduleField extends GroupControl{
		
	private SelectField scheduleField;
	private PushButton      newButton;
	private PushButton      editButton;
	private PushButton      deleteButton;
	private Action NewScheduleAction;
	private Action EditScheduleAction;
	
		
	public ScheduleField(String bindID){
		setBindID(bindID);
		createAction();
		createFields();
		createLayout();
	}	
	
	private void createAction() {
		// TODO Auto-generated method stub
		NewScheduleAction = new NewEditScheduleAction();
		EditScheduleAction = new EditScheduleAction();
		
	}

	private void createFields() {
		scheduleField = new SelectField("domains", "domain");
		scheduleField.setPreferredSize(new Dimension(166, 20));
		
		newButton = new PushButton(NewScheduleAction);
		editButton = new PushButton(EditScheduleAction);
		deleteButton = new PushButton("deleteAction");
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		
		setLayout(new FormLayout())
		.addLabel("label.schedule       ")		.addField(scheduleField);
		addField(createForm());
	}	
	
	private GroupControl createButtons() {
		GroupControl buttons = new GroupControl();
		buttons.setLayout(new FlowLayout(FlowLayout.LEFT));
		buttons.addField(newButton);
		buttons.addField(editButton);
		buttons.addField(deleteButton);
		return buttons;
		}


	private FormField createForm()
	{
		GroupControl form = new GroupControl();
	form.addField(createButtons(), NORTH);
	return form;
	}

}

